<template>
	<view>
		<view class="color999 u-font-24 h-80 flex align-center  bg-white u-p-l-40 u-p-r-40">学院：<text
				class="color333 u-font-28">{{info.college || ''}}</text> </view>
		<view class="color999 u-font-24 h-80 flex align-center u-m-t-5  bg-white u-p-l-40 u-p-r-40">学习形式：<text
				class="color333 u-font-28">{{info.studyType || ''}}</text> </view>
		<view class="color999 u-font-24 h-80 flex align-center u-m-t-5  bg-white u-p-l-40 u-p-r-40">近四年平均复录比：<text
				class="color333 u-font-28">{{rate || '无'}}</text> </view>
		<view class="u-p-t-20 bg-white u-m-t-5 u-p-l-40 u-p-r-40">
			<view class="color999 u-font-24">初试科目和参考书：</view>
			<view class="u-m-t-20 u-p-b-20" v-for="(item,index) in diretion" :key="index">
				<view class="u-font-28 color333 bold">{{item.name}}</view>
				<view class="u-font-24 color555 bookDesc word-break-all u-m-t-10" v-for="(items,indexs) in item.subject"
					:key="indexs">
					<view>
						科目{{$numberToChinese((indexs + 1))}}：{{items.code}}
					</view>
					<view v-if="items.book" class="color999">
						<text>参考书目见[{{items.book}}]</text>
					</view>
				</view>
			</view>
		</view>
		<view class="u-p-t-20 bg-white  u-m-t-5 u-p-l-40 u-p-r-40">
			<view class="u-font-24 color999">复试内容：</view>
			<view class="u-m-t-20 u-p-b-20 word-break-all bookDesc color555">无</view>
		</view>
		<view class="u-p-t-20 bg-white  u-m-t-5 u-p-l-40 u-p-r-40">
			<view class="u-font-24 color999">录取要求：</view>
			<view class="u-m-t-20 u-p-b-20 word-break-all bookDesc color555">无</view>
		</view>
		<view class="u-p-t-20 bg-white  u-m-t-5 u-p-l-40 u-p-r-40">
			<view class="u-font-24 color999">复试参考书：</view>
			<view v-if="priceInfo.resetBook" class="u-m-t-20 u-p-b-20 word-break-all bookDesc color555">
				{{ priceInfo.resetBook }}
			</view>
			<view v-else class="u-m-t-20 u-p-b-20 word-break-all bookDesc color555">无</view>
		</view>
		<view class="u-p-t-20 bg-white  u-m-t-5 u-p-l-40 u-p-r-40">
			<view class="u-font-24 color999">学制：</view>
			<view v-if="priceInfo.educationalSystem" class="u-m-t-20 u-p-b-20 word-break-all bookDesc color555">
				{{ priceInfo.educationalSystem }}
			</view>
			<view v-else class="u-m-t-20 u-p-b-20 word-break-all bookDesc color555">无</view>
		</view>
		<view class="u-p-t-20 bg-white  u-m-t-5 u-p-l-40 u-p-r-40">
			<view class="u-font-24 color999">学费：</view>
			<view v-if="priceInfo.tuition" class="u-m-t-20 u-p-b-20 word-break-all bookDesc color555">
				{{ priceInfo.tuition }}
			</view>
			<view v-else class="u-m-t-20 u-p-b-20 word-break-all bookDesc color555">无</view>
		</view>
		<view class="u-p-t-20 bg-white  u-m-t-5 u-p-l-40 u-p-r-40">
			<view class="u-font-24 color999">奖学金：</view>
			<view v-if="priceInfo.scholarship" class="u-m-t-20 u-p-b-20 word-break-all bookDesc color555">
				{{ priceInfo.scholarship }}
			</view>
			<view v-else class="u-m-t-20 u-p-b-20 word-break-all bookDesc color555">无</view>
		</view>
		<view class="u-p-t-20 bg-white  u-m-t-5 u-p-l-40 u-p-r-40">
			<view class="u-font-24 color999">导师：</view>
			<view class="u-m-t-20 u-p-b-20 word-break-all bookDesc color555" v-if="teacherList && teacherList.length">
				<text class="u-m-r-20" v-for="(item,index) in teacherList" :key="index">{{ item.userName }}</text>
			</view>
			<view v-else class="u-m-t-20 u-p-b-20 word-break-all bookDesc color555">无</view>
		</view>
	</view>
</template>

<script>
	import {
		getOther,
		getTeacherList,
		getSchoolPriceInfo,
		getRetestEnrollRate
	} from '@/api/toolbox.js';
	export default {
		props: ['info'],
		data() {
			return {
				//学制学费奖学金
				priceInfo: {},
				teacherList: [],
				diretion: [],
				rate: ''
			}
		},
		mounted() {
			this.getOtherList();
			this.getTeacherLists();
			this.getSchoolProceInfos();
			this.getRetestEnrollRate();
		},
		methods: {
			getRetestEnrollRate() {
				getRetestEnrollRate({
					'collegeCode': this.info.collegeCode,
					'majorCode': this.info.majorCode,
					'schoolCode': this.info.schoolCode,
				}).then(res => {
					if (res.code = 100000) {
						this.rate = res.data;
					}
				})
			},
			getSchoolProceInfos() {
				uni.showLoading({
					mask: true
				});
				getSchoolPriceInfo({
					'collegeCode': this.info.collegeCode,
					'majorCode': this.info.majorCode,
					'schoolCode': this.info.schoolCode,
				}).then(res => {
					if (res.code == 100000) {
						this.priceInfo = res.data;
					}
				}).finally(() => {
					uni.hideLoading();
				})
			},
			getTeacherLists() {
				getTeacherList({
					'collegeCode': this.info.collegeCode,
					'majorCode': this.info.majorCode,
					'schoolCode': this.info.schoolCode,
					'year': new Date().getFullYear(),
					'pageNum': 1,
					'pageSize': 10,
				}).then(res => {
					if (res.code == 100000) {
						this.teacherList = res.data.rows
					}
				})
			},
			getOtherList() {
				getOther({
					'collegeCode': this.info.collegeCode,
					'majorCode': this.info.majorCode,
					'schoolCode': this.info.schoolCode,
				}).then(res => {
					if (res.data && res.data.directionsN) {
						let list = [];
						let data = res.data.directionsN;
						data.forEach(e => {
							list.push({
								year: e.coreStudyDirectionEntityList[0].majorYear,
								name: e.coreStudyDirectionEntityList[0].name,
								subject: [{
									code: e.tbaseExamSubjectList[0].code1,
									book: e.tbaseExamSubjectList[0].book1,
								}, {
									code: e.tbaseExamSubjectList[0].code2,
									book: e.tbaseExamSubjectList[0].book2,
								}, {
									code: e.tbaseExamSubjectList[0].code3,
									book: e.tbaseExamSubjectList[0].book3,
								}, {
									code: e.tbaseExamSubjectList[0].code4,
									book: e.tbaseExamSubjectList[0].book4,
								}]
							})
						})
						this.diretion = list;
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.bookDesc {
		line-height: 2;
		text-indent: 1.5rem;
	}

	.h-80 {
		height: 80rpx;
	}

	.color555 {
		color: #555555;
	}
</style>